package com.ibm.spatiotemp.server.framework.processor.fake;

import org.apache.log4j.Logger;

import com.ibm.spatiotemp.server.datamodel.gpsdata.TSPointResultSet;
import com.ibm.spatiotemp.server.datasources.DataSource;
import com.ibm.spatiotemp.server.framework.processor.RawDataProcessor;
import com.ibm.spatiotemp.server.framework.request.Request;

public class FakeRawDataProcessor extends RawDataProcessor{
	public static Logger logger = Logger.getLogger(FakeRawDataProcessor.class);
	public FakeRawDataProcessor(DataSource src) {
		super(src);
	}


	@Override
	public TSPointResultSet handleRawDataQuery(Request request) throws Exception {
		logger.info("handleRawDataQuery::" + request.toJsonString());
		TSPointResultSet res = dataaccessor.ScanGPSData(request);
		return res;
	}

	@Override
	public String handleRawDataInsert(Request request) throws Exception {
		logger.info("data to be inserted: "+
					request.getData());
		String query_string = "";
		
		int res = dataaccessor.WriteGPSData(query_string,null);
		return String.format("[%d]", res);
	}
}
